/**
 * Created by sky on 9/1/2017.
 */
const express = require('express');
const foodController = require('../controllers/food.server.controller');
const multiparty = require('connect-multiparty')
const multipartMiddleware = multiparty();


module.exports = (app) => {

    const router = express.Router();
    router.use(function (req, res, next) {
       console.log("foodroute");
       next();
    });

    router.route('/').get(foodController.findAllFoods);
    router.route('/').post(multipartMiddleware,foodController.addFood); 
    router.route('/food').post(multipartMiddleware,foodController.updateFood);
    router.route('/:id').delete(foodController.deleteFood); 
    router.route('/categories/:categories').get(foodController.findFoodByCategories); 

    app.use('/food', router);
 };